package com.zprmb.udzt.activity;

import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.RequiresApi;
import android.support.v4.hardware.fingerprint.FingerprintManagerCompat;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.umeng.analytics.MobclickAgent;
import com.zprmb.udzt.BaseActivity;
import com.zprmb.udzt.BbtApplication;
import com.zprmb.udzt.CustomDialog_view_new;
import com.zprmb.udzt.LoginActivity;
import com.zprmb.udzt.PayDexterityActivity;
import com.zprmb.udzt.R;
import com.zprmb.udzt.V6FingerPayPwdConfirmActivity;
import com.zprmb.udzt.V6LoginActivity;
import com.zprmb.udzt.V6ResultFinsh;
import com.zprmb.udzt.V6WebviewChild;
import com.zprmb.udzt.bean.JiaoYanFailBean;
import com.zprmb.udzt.bean.LimitBean;
import com.zprmb.udzt.bean.YuePaySuccess;
import com.zprmb.udzt.http.AjaxParams;
import com.zprmb.udzt.model.YanZhengModel;
import com.zprmb.udzt.util.Constant;
import com.zprmb.udzt.util.CustomDialog2;
import com.zprmb.udzt.util.ExplosionField;
import com.zprmb.udzt.util.FingerSetting;
import com.zprmb.udzt.util.FingerprintUtil;
import com.zprmb.udzt.util.LogUtils;
import com.zprmb.udzt.util.MySharePreferenceUtil;
import com.zprmb.udzt.util.NewVolleryUtil;
import com.zprmb.udzt.util.NumUtil;
import com.zprmb.udzt.util.Regular;
import com.zprmb.udzt.util.TimeUtils;
import com.zprmb.udzt.util.ToastUtil;
import com.zprmb.udzt.util.VolleryUtil;
import com.zprmb.udzt.util.VolleryUtil3;
import com.zprmb.udzt.zhitoudialog.ZhiTouAlertDialog;

import org.json.JSONObject;

import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import de.greenrobot.event.EventBus;

import static com.zprmb.udzt.R.drawable.a;
import static com.zprmb.udzt.R.drawable.v6button;
import static com.zprmb.udzt.R.id.amount;


public class V6NewZhiTouDexterityPayInActivity extends BaseActivity implements OnClickListener, ZhiTouAlertDialog.OnSureClickListener {
    //    private AddAndSubView addAndSubView;
    private TextView tv_v6_dexterity_pay_in_keyong;
    //    private TextView tv_v6_dexterity_pay_in_chiyou;
    private TextView tv_v6_dexterity_pay_in_shouyi;
    private Button tv_v6_dexterity_pay_in_updata;
    private Double million;
    private Double inAmount;
    private TextView tv_product_shouyi;
    private int remainAmount;
    private int increaseNum;// 增量
    private int minAmount;

    private Double maxAmount;
    private int max_hold;
    private Double availableAmount;
    private ListView lv_comment;

    private TextView check_mAgreement;
    private CheckBox check;
    private LinearLayout li_dexterity;
    private ExplosionField mExplosionField;//粉碎动画执行方法类
    private TextView tv_v6_dexterity_pay_in_daotime;
    private TextView tv_v6_dexterity_pay_in_shengyu;
    DecimalFormat df = new DecimalFormat("###0.00");
    private List<String> list = new ArrayList<String>();
    //
    private TextView tv_mAgreement;

    String receivemoney = "";

    //输入框的money

    private EditText edit_zhitoumoney;
//剩余可投金额

    String shengyu;

    //剩余可投金额的布局

    LinearLayout layout_investall;

    TextView text_yue;

    TextView text_quantou;

    //清理了
    ImageView iv_cleardadta;
    LinearLayout layout_clear;

    //整体布局

    LinearLayout li_all;

    RelativeLayout rl_back;

    ImageView img_back;
    TextView tv_guize;

    TextView tv_title;
    private CustomDialog_view_new.Builder builder;

    String zhanghu_keyong;

    //账户可用余额
    private Double availableAmount2 = 0.0;
    int zhangu_keyong = 0;

    //持有金额

    int chiyou = 0;

    int singleTransfer = 0;

    private final String ACTION_NAME = "智投宝结束";
    private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            if (action.equals(ACTION_NAME)) {
                finish();
            }
        }

    };

    public void registerBoradcastReceiver() {
        IntentFilter myIntentFilter = new IntentFilter();
        myIntentFilter.addAction(ACTION_NAME);
        //注册广播
        registerReceiver(mBroadcastReceiver, myIntentFilter);
    }

    private boolean flag = true;
    public static V6NewZhiTouDexterityPayInActivity instance = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_v6newzhitou);
        EventBus.getDefault().register(this);
        instance = this;
        setImmersionStatus();
        setContentInview(this).setVisibility(View.INVISIBLE);
        rl_back = (RelativeLayout) findViewById(R.id.rl_back);
        rl_back.setOnClickListener(this);
        //标题
        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText("转入");
        img_back = (ImageView) findViewById(R.id.img_back);
        img_back.setOnClickListener(this);
        tv_guize = (TextView) findViewById(R.id.tv_guize);
        tv_guize.setOnClickListener(this);
        setgoback(V6NewZhiTouDexterityPayInActivity.this);
        check = (CheckBox) findViewById(R.id.check);
        registerBoradcastReceiver();
        tv_mAgreement = (TextView) findViewById(R.id.tv_mAgreement);
        check_mAgreement = (TextView) findViewById(R.id.check_mAgreement);
        li_dexterity = (LinearLayout) findViewById(R.id.li_dexterity);
        layout_clear = (LinearLayout) findViewById(R.id.layout_clear);
        iv_cleardadta = (ImageView) findViewById(R.id.iv_cleardadta);
        tv_v6_dexterity_pay_in_shengyu = (TextView) findViewById(R.id.tv_v6_dexterity_pay_in_shengyu);
//        addAndSubView = (AddAndSubView) findViewById(R.id.add_subview);
        tv_v6_dexterity_pay_in_keyong = (TextView) findViewById(R.id.tv_v6_dexterity_pay_in_keyong);
//        tv_v6_dexterity_pay_in_chiyou = (TextView) findViewById(R.id.tv_v6_dexterity_pay_in_chiyou);
        tv_v6_dexterity_pay_in_shengyu = (TextView) findViewById(R.id.tv_v6_dexterity_pay_in_shengyu);
        tv_v6_dexterity_pay_in_updata = (Button) findViewById(R.id.tv_v6_dexterity_pay_in_updata);
        tv_v6_dexterity_pay_in_daotime = (TextView) findViewById(R.id.tv_v6_dexterity_pay_in_daotime);
        tv_product_shouyi = (TextView) findViewById(R.id.tv_product_shouyi);

        receivemoney = String.valueOf(getIntent().getIntExtra("investamount", 0));
//        Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, receivemoney+"", Toast.LENGTH_SHORT).show();

        if (tv_v6_dexterity_pay_in_daotime.getText().toString().contains("上限50万元")) {
            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
            tv_v6_dexterity_pay_in_updata.setEnabled(false);
            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
            layout_investall.setEnabled(false);
            text_yue.setEnabled(false);
            text_quantou.setEnabled(false);
        }


        if (tv_v6_dexterity_pay_in_daotime.getText().toString().contains("请输入")) {
            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
        } else if (tv_v6_dexterity_pay_in_daotime.getText().toString().contains("预期")) {
            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#757575"));
        }


        edit_zhitoumoney = (EditText) findViewById(R.id.edit_zhitoumoney);

        if (receivemoney.equals("0")) {
            edit_zhitoumoney.setText("");
        } else {
            edit_zhitoumoney.setText(receivemoney);
            edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
        }


        tv_product_shouyi.setVisibility(View.INVISIBLE);
//投资按钮
        tv_v6_dexterity_pay_in_updata.setOnClickListener(this);
//整体布局
        li_all = (LinearLayout) findViewById(R.id.li_all);


        layout_investall = (LinearLayout) findViewById(R.id.layout_investall);
        text_yue = (TextView) findViewById(R.id.text_yue);
        text_quantou = (TextView) findViewById(R.id.text_quantou);
        layout_investall.setOnClickListener(this);
        text_yue.setOnClickListener(this);
        text_quantou.setOnClickListener(this);
        check.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                // TODO Auto-generated method stub
                if (isChecked) {
                    if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                        if (Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);

                        } else {
                            tv_v6_dexterity_pay_in_updata.setEnabled(true);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                        }
                    } else {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    }
                } else {
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                }
            }
        });
        check_mAgreement.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                }
                    if (check.isChecked()) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        check.setChecked(false);
                    } else {
                        tv_v6_dexterity_pay_in_updata.setEnabled(true);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                        check.setChecked(true);


                    }
                }
            });
        tv_mAgreement.setOnClickListener(new

            OnClickListener() {

                @Override
                public void onClick (View v){
                    // TODO Auto-generated method stub
                    Intent intent2 = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                            WebZhitouActivity.class);
                    intent2.putExtra("url", "landing/currentAgreement?app=true&token=");
                    intent2.putExtra("flag", flag);
                    intent2.putExtra("share", 1);
                    intent2.putExtra("titleview", 1);
                    intent2.putExtra("title", "《智投宝授权委托书》");
                    startActivity(intent2);
//                startActivityForResult(intent2, 1000);
                }
            });
//        verityUser();
        edit_zhitoumoney.addTextChangedListener(new

            TextWatcher() {
                @Override
                public void beforeTextChanged (CharSequence s,int start, int count, int after){
                }

                @Override
                public void onTextChanged (CharSequence s,int start, int before, int count){
                }

                @Override
                public void afterTextChanged (Editable s){
                    if (edit_zhitoumoney.getText().length() != 0) {
                        iv_cleardadta.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_updata.setEnabled(true);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                        tv_v6_dexterity_pay_in_updata.setTextColor(getResources().getColor(R.color.white));
                        int b = Double.valueOf(edit_zhitoumoney.getText().toString()).intValue();
                        new Handler().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                try {
                                    if (!check.isChecked()) {
                                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                    } else {
                                        if (TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_daotime.setText("转入金额不能为空");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.GONE);
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.btn_unclick2);
                                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (chiyou + Double.valueOf(edit_zhitoumoney.getText().toString()).intValue()) > max_hold) {
                                            int a = max_hold / 10000;

                                            tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为" + a + "万元");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && edit_zhitoumoney.getText().toString().equals("0")) {
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));

                                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                                            tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                        } else if ((Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - minAmount)
                                                % increaseNum != 0) {
//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额的增量须为" + increaseNum + "的倍数");
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_daotime.setText("转入金额增量须为" + increaseNum + "的整数倍");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
//                                    tv_v6_dexterity_pay_in_daotime.setTextColor(getResources().getColor(R.color.bbt_v4_uplan_fragment_progress_ditou_quan));
                                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > maxAmount.intValue()) {
//                                    tv_v6_dexterity_pay_in_daotime.setText("持有金额已超上限50万元");

                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);

                                            int a = singleTransfer / 10000;
//                       tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                                            Double b = Math.floor(a);

//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                                            tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou <= 0 && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() > maxAmount.intValue()) {
//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);

                                            int a = singleTransfer / 10000;
//                       tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                                            Double b = Math.floor(a);

//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                                            tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                                        } else {
                                            tv_v6_dexterity_pay_in_updata.setEnabled(true);
                                            tv_v6_dexterity_pay_in_daotime.setText("预期收益到账时间 :" + mytime);
                                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#757575"));
                                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                                        }
                                    }


                                } catch (
                                        Exception e)

                                {

                                }

                            }
                        }, 500);
                    } else if (receivemoney.equals("0")) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_daotime.setText("请输入转入金额");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                    } else if (TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额不能为空");
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        iv_cleardadta.setVisibility(View.GONE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (chiyou + Double.valueOf(edit_zhitoumoney.getText().toString()).intValue()) > max_hold) {
//                    tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为50万元");
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        int a = max_hold / 10000;
                        tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为" + a + "万元");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        iv_cleardadta.setVisibility(View.VISIBLE);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && edit_zhitoumoney.getText().toString().equals("0")) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        iv_cleardadta.setVisibility(View.VISIBLE);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - minAmount)
                            % increaseNum != 0) {
//                    tv_v6_dexterity_pay_in_daotime.setText("转入金额的增量须为" + increaseNum + "的倍数");
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额增量须为" + increaseNum + "的整数倍");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        iv_cleardadta.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
//                                    tv_v6_dexterity_pay_in_daotime.setTextColor(getResources().getColor(R.color.bbt_v4_uplan_fragment_progress_ditou_quan));
                    } else if (zhanghu_keyong.equals("0.0")) {
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                        layout_investall.setEnabled(false);
                        text_yue.setEnabled(false);
                        text_quantou.setEnabled(false);
                        text_quantou.setTextColor(getResources().getColor(R.color.grew));
                        text_yue.setTextColor(getResources().getColor(R.color.grew));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > maxAmount.intValue()) {
//                    tv_v6_dexterity_pay_in_daotime.setText("持有金额已超上限50万元");
               /*     tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);

                    int a = maxAmount.intValue() / 10000;
                    tv_v6_dexterity_pay_in_daotime.setText("持有金额上限为" + a + "万元");
                    tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    iv_cleardadta.setVisibility(View.VISIBLE);

                    tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);

                    int a = singleTransfer / 10000;*/
//                       tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                        Double b = Math.floor(a);

//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou <= 0 && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() > maxAmount.intValue()) {
//                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
 /*                   int a = maxAmount.intValue() / 10000;
                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + a + "万元");
                    tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                    tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    iv_cleardadta.setVisibility(View.VISIBLE);*/
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);

                        int a = singleTransfer / 10000;
//                       tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                        Double b = Math.floor(a);

//                                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    } else {
                        iv_cleardadta.setVisibility(View.INVISIBLE);
//                    tv_v6_dexterity_pay_in_daotime.setVisibility(View.GONE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#757575"));
                        tv_v6_dexterity_pay_in_daotime.setText("预期收益到账时间 :" + mytime);
                        iv_cleardadta.setVisibility(View.GONE);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                        tv_v6_dexterity_pay_in_updata.setEnabled(true);
                    }


                }
            });
            /**焦点变化监听**/
        edit_zhitoumoney.setOnFocusChangeListener(new View.OnFocusChangeListener()

            {
                @Override
                public void onFocusChange (View arg0,boolean arg1){
                // TODO Auto-generated method stub
                if (edit_zhitoumoney.getText().length() != 0) {
                    //删除图标显示
                    iv_cleardadta.setVisibility(View.VISIBLE);
                } else {
                    //删除图标隐藏
                    iv_cleardadta.setVisibility(View.INVISIBLE);
                }
                if (arg1) {
                    //得到焦点
                } else {
                    //失去焦点，删除图标隐藏
                    iv_cleardadta.setVisibility(View.INVISIBLE);
                }

            }
            });
            //删除图标的点击监听事件
        iv_cleardadta.setOnClickListener(new

            OnClickListener() {

                @Override
                public void onClick (View arg0){
                    edit_zhitoumoney.setText("");
//                                                         edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                    tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);

                }
            });
        layout_clear.setOnClickListener(new

            OnClickListener() {
                @Override
                public void onClick (View v){
                    edit_zhitoumoney.setText("");
//                                                        edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                    tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    tv_v6_dexterity_pay_in_updata.setEnabled(false);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);

                }
            });

            payIn();


            // 如果是第一次启动，则先进入功能引导页
        if(MySharePreferenceUtil.get(V6NewZhiTouDexterityPayInActivity.this,"zhitou","").

            equals("1"))

            {
                li_all.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        showPopupWindow2(li_all);
                    }
                }, 500);

            }


        }

        public void onEventMainThread (Integer type){
            Log.e("---", "EventBus收到int:" + type);
            if (type == 100) {
                check.setChecked(true);

            }

        }


        private PopupWindow popWindow2;

        private void showPopupWindow2 (View parent){
            if (popWindow2 == null) {
                View view2 = LayoutInflater.from(this)
                        .inflate(R.layout.pop_second, null);
                //LayoutParams相当于一个Layout的信息包，它封装了Layout的位置、高、宽等信息。
                popWindow2 = new PopupWindow(view2, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
                initPop2(view2);
            }
            //设置动画效果
            popWindow2.setAnimationStyle(android.R.style.Animation_InputMethod);
            //获取popwindow焦点
            popWindow2.setFocusable(true);
            //设置popwindow如果点击外面区域，便关闭。
            popWindow2.setOutsideTouchable(true);
            popWindow2.setBackgroundDrawable(new BitmapDrawable());
            //实现软键盘不自动弹出,ADJUST_RESIZE属性表示Activity的主窗口总是会被调整大小，从而保证软键盘显示空间。
            popWindow2.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            //设置popwindow显示位置
            popWindow2.showAtLocation(parent, Gravity.CENTER, 0, 0);
        }

        public void initPop2 (View view){
            final LinearLayout layout_pop_first = (LinearLayout) view.findViewById(R.id.layout_pop_first);

            layout_pop_first.getBackground().setAlpha(175);
            layout_pop_first.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow2.dismiss();
                    showPopupWindow4(layout_pop_first);
                }
            });
        }

        PopupWindow popWindow4;

        private void showPopupWindow4 (View parent){
            if (popWindow4 == null) {
                View view2 = LayoutInflater.from(this)
                        .inflate(R.layout.pop_fourth, null);
                //LayoutParams相当于一个Layout的信息包，它封装了Layout的位置、高、宽等信息。
                popWindow4 = new PopupWindow(view2, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
                initPop4(view2);
            }
            //设置动画效果
            popWindow4.setAnimationStyle(android.R.style.Animation_InputMethod);
            //获取popwindow焦点
            popWindow4.setFocusable(true);
            //设置popwindow如果点击外面区域，便关闭。
            popWindow4.setOutsideTouchable(true);
            popWindow4.setBackgroundDrawable(new BitmapDrawable());
            //实现软键盘不自动弹出,ADJUST_RESIZE属性表示Activity的主窗口总是会被调整大小，从而保证软键盘显示空间。
            popWindow4.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            //设置popwindow显示位置
            popWindow4.showAtLocation(parent, Gravity.CENTER, 0, 0);
        }

        public void initPop4 (View view){
            LinearLayout layout_pop_third = (LinearLayout) view.findViewById(R.id.layout_pop_fourth);

            layout_pop_third.getBackground().setAlpha(175);
            layout_pop_third.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow4.dismiss();
//                MySharePreferenceUtil.getBoolean(V6NewZhiTouDexterityPayInActivity.this, SharePreferenceUtil.FIRST_OPEN1, true);
                    MySharePreferenceUtil.put(V6NewZhiTouDexterityPayInActivity.this, "zhitou", "2");
                }
            });

            Button button = (Button) view.findViewById(R.id.tv_v6_dexterity_pay_in_updata);
            button.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow4.dismiss();
//                MySharePreferenceUtil.getBoolean(V6NewZhiTouDexterityPayInActivity.this, SharePreferenceUtil.FIRST_OPEN1, true);
                    MySharePreferenceUtil.put(V6NewZhiTouDexterityPayInActivity.this, "zhitou", "2");
                }
            });
        }

        String s = "";
        String mytime;

        String zhanghu_keyong_xiaosh = "0";

        private void payIn () {
            VolleryUtil vollery = new VolleryUtil() {

                @Override
                public void onUpDate(JSONObject jsonObject) {
                    // TODO Auto-generated method stub
                    LogUtils.e("转入", jsonObject.toString());

                    if (jsonObject.optInt("success") == 1) {
                        setContentInview(V6NewZhiTouDexterityPayInActivity.this).setVisibility(View.VISIBLE);

                        JSONObject json = jsonObject.optJSONObject("data");
//剩余可投金额
                        remainAmount = json.optInt("maxAmount");
                        increaseNum = json.optInt("increaseNum");
                        minAmount = json.optInt("minAmount");
                        maxAmount = json.optDouble("holdCapAmount");
                        chiyou = json.optInt("currentAmount");
                        max_hold = json.optInt("holdCapAmount");

                        tv_v6_dexterity_pay_in_shengyu.setText(NumUtil.getQiantwo(json.optString("maxAmount")));
                        tv_v6_dexterity_pay_in_keyong.setText(NumUtil.getQiantwo(json.optString("userFundAvailableAmount")));
                        zhanghu_keyong = json.optString("userFundAvailableAmount");
                        zhanghu_keyong_xiaosh = NumUtil.getQiantwo(json.optString("userFundAvailableAmount"));

                        zhangu_keyong = json.optInt("userFundAvailableAmount");
                        availableAmount2 = json.optDouble("userFundAvailableAmount");
                        shengyu = json.optString("maxAmount");
                        singleTransfer = json.optInt("singleTransfer");
                        String time = TimeUtils.formatTime(new Date(Long
                                .valueOf(json.optString("nextWorkDay"))));
                        Log.e("时间", time);
                        mytime = time;
//                    tv_v6_dexterity_pay_in_daotime.setText("预期收益到账时间 :" + time);
                        productId = json.optString("productId");
                        inAmount = json.optDouble("maxTransferAmount");
                        availableAmount = json.optDouble("availableAmount");

//					addAndSubView.setMinnum(minAmount);
                        Gson gson = new Gson();
                        list = gson.fromJson(json.optString("promptList"),
                                new TypeToken<ArrayList<String>>() {
                                }.getType());

                        edit_zhitoumoney.setHint(minAmount + "元起投" + increaseNum + "元递增");

//
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this,zhanghu_keyong+ "", Toast.LENGTH_SHORT).show();
                        if (availableAmount2 <= 0 && TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                            layout_investall.setEnabled(false);
                            text_yue.setEnabled(false);
                            text_quantou.setEnabled(false);
                            text_quantou.setTextColor(getResources().getColor(R.color.grew));
                            text_yue.setTextColor(getResources().getColor(R.color.grew));
                        } else if (availableAmount2 <= 0 && !TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
//                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                            layout_investall.setEnabled(false);
                            text_yue.setEnabled(false);
                            text_quantou.setEnabled(false);
                            text_quantou.setTextColor(getResources().getColor(R.color.grew));
                            text_yue.setTextColor(getResources().getColor(R.color.grew));
                        }

                        if (TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                            tv_v6_dexterity_pay_in_daotime.setText("转入金额不能为空");
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > maxAmount.intValue()) {

                            int a = maxAmount.intValue() / 10000;
                            tv_v6_dexterity_pay_in_daotime.setText("持有金额上限为" + a + "万元");
//                        tv_v6_dexterity_pay_in_daotime.setText("持有金额已超上限50万元");
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou <= 0 && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() > maxAmount.intValue()) {

                            int a = singleTransfer / 10000;
//                        tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                            Double b = Math.floor(a);

//                        tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                            tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (chiyou + Double.valueOf(edit_zhitoumoney.getText().toString()).intValue()) > max_hold) {
//                        tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为50万元");
                            int a = max_hold / 10000;
                            tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为" + a + "万元");
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && edit_zhitoumoney.getText().toString().equals("0")) {
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                            tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                            tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - minAmount)
                                % increaseNum != 0) {
                            tv_v6_dexterity_pay_in_daotime.setText("转入金额增量须为" + increaseNum + "的整数倍");
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
//                                    tv_v6_dexterity_pay_in_daotime.setTextColor(getResources().getColor(R.color.bbt_v4_uplan_fragment_progress_ditou_quan));
                        } /*else if (tv_v6_dexterity_pay_in_keyong.getText().toString().equals("0.00")) {
//                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button);
//                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        layout_investall.setEnabled(false);
                        text_yue.setEnabled(false);
                        text_quantou.setEnabled(false);
                        text_quantou.setTextColor(getResources().getColor(R.color.grew));
                        text_yue.setTextColor(getResources().getColor(R.color.grew));
                    } *//*else if () {

                    } */ else {
                            tv_v6_dexterity_pay_in_updata.setEnabled(true);
                            tv_v6_dexterity_pay_in_daotime.setText("预期收益到账时间 :" + mytime);
                            tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#757575"));
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button2);
                            tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        }

                        for (int i = 0; i < list.size(); i++) {
                            s = s + list.get(i);
                        }


                    } else {
                        if (jsonObject.optString("comment").equals("please login")) {
                            Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                    V6LoginActivity.class);
                            intent.putExtra("close", 1);
                            intent.putExtra("web", 1);
                            startActivity(intent);
                        } else {
                            ToastUtil.showCenterToast(V6NewZhiTouDexterityPayInActivity.this,
                                    jsonObject.optString("comment"));
                        }

                    }
                }

                @Override
                public void onError() {
                    // TODO Auto-generated method stub
                    setContentInview(V6NewZhiTouDexterityPayInActivity.this).setVisibility(View.INVISIBLE);

                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, "请求失败   请检查网络设置",
                            2000).show();
                }
            };
            vollery.setShow(true);
            vollery.setHeaders("token", getToken());
            vollery.setHeaders("client", "android");
            vollery.setRequestMethod(1);
            vollery.execute(this, Constant.URL + "/api/v2/claim/fund/intelli/in", "");
        }

        @Override
        protected void onResume () {
            // TODO Auto-generated method stub
            super.onResume();
            li_all.performClick();

//        payIn();
        }

        private void verityUser () {
            VolleryUtil vollery = new VolleryUtil() {

                @Override
                public void onUpDate(JSONObject jsonObject) {
                    // TODO Auto-generated method stub
                    if (jsonObject.optInt("success") == 1) {
                        Log.d(jsonObject.toString(), "44444444444444");
                        Gson gson = new Gson();

                        JSONObject json = jsonObject.optJSONObject("data");
                        Intent intent = null;

                        if (!json.optBoolean("isBindCard")) {
                            intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                    V6WebviewChild.class);
                            intent.putExtra("url", Constant.URL + "h5/account/bankcard/bind/view?app=true&token=");
                            intent.putExtra("title", "智投宝");
                            startActivity(intent);
                            return;
                        }


                    } else {
                        if (jsonObject.optString("comment").equals("please login")) {
                            Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                    V6LoginActivity.class);
                            startActivity(intent);
                        } else {
                            ToastUtil.showCenterToast(V6NewZhiTouDexterityPayInActivity.this,
                                    jsonObject.optString("comment"));
                        }
                    }
                }

                @Override
                public void onError() {
                    // TODO Auto-generated method stub

                }
            };
            vollery.setHeaders("token", getToken());
            vollery.setHeaders("client", "android");
            vollery.setShow(true);
            vollery.setRequestMethod(0);
            vollery.execute(V6NewZhiTouDexterityPayInActivity.this, Constant.URL
                    + "/api/v5/user/userInfo", "");
        }

        private void setImmersionStatus () {
            if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
                // 透明状态栏
                getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                // 透明导航栏
                //getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            }
        }


        String path;
        String myamount;
        String bank_name;
        String investment_Amount;
        String bankName;
        String card_no;
        String type2;
        String loan_id;
        String productId;


        public void onFingerprintClick ( final int type){
            FingerprintUtil.callFingerPrint(new FingerprintUtil.OnCallBackListenr() {
                @Override
                public void onSupportFailed() {
                    showToast("当前设备不支持指纹");
                }

                @Override
                public void onInsecurity() {
                    showToast("当前设备未处于安全保护中");
                }

                @Override
                public void onEnrollFailed() {
                    showToast("请到设置中设置指纹");
                }

                @Override
                public void onAuthenticationStart() {
//                li_tishi.getVisibility()

                    builder = new CustomDialog_view_new.Builder(V6NewZhiTouDexterityPayInActivity.this);

                    builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            FingerprintUtil.cancel();
                            builder.create().dismiss();
                            builder = null;
                            Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                    PayDexterityActivity.class);
                            intent.putExtra("type", "IN");

//                    CURRENT_DEPOSIT
                            tv_v6_dexterity_pay_in_updata
                                    .setBackgroundResource(R.drawable.btn_unclick);
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata
                                    .setBackgroundResource(R.drawable.v6button2);
                            tv_v6_dexterity_pay_in_updata.setEnabled(true);
//                    intent.putExtra("amount", addAndSubView.getNum() + "");
                            intent.putExtra("amount", edit_zhitoumoney.getText().toString());

                            intent.putExtra("productId", productId);
                            LogUtils.e("智投宝id", productId);
                            startActivity(intent);
                            popWindow.dismiss();
                            popWindow = null;
                            V6NewZhiTouDexterityPayInActivity.count = 0;
                            overridePendingTransition(R.anim.right_in,
                                    R.anim.right_in);
                        }
                    });
                /*builder.setMessage("“优点智投”的 Touch ID");
                builder.setMessage2("请验证已有手机指纹");*/
                    builder.setMessage("请验证已有手机指纹");

//                builder.setMessage4("");
                    builder.create().setCancelable(false);
                    builder.create().show();


                }

                @Override
                public void onAuthenticationError(int errMsgId, CharSequence errString) {
                    if (errMsgId == 7) {
                        verityUser();
                    } else {
                        showToast(errString.toString());
                    }
/*                if (builder.create() != null) {
                    builder.create().dismiss();
//                    builder = null;
                }*/

                }

                @Override
                public void onAuthenticationFailed() {

                    showToast("再试一次");

                    for (int i = 0; i < 1; i++) {

                        new V6NewZhiTouDexterityPayInActivity().method();
                    }
                    Log.d("方法一共被调用了", "" + V6NewZhiTouDexterityPayInActivity.count + "" + "次数");
//                MySharePreferenceUtil.put(V6NewZhiTouDexterityPayInActivity.this, "zhitou", count);


                    if (V6NewZhiTouDexterityPayInActivity.count > 3) {
                        Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                PayDexterityActivity.class);
                        intent.putExtra("type", "IN");

//                    CURRENT_DEPOSIT
                        tv_v6_dexterity_pay_in_updata
                                .setBackgroundResource(R.drawable.btn_unclick);
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata
                                .setBackgroundResource(v6button);
                        tv_v6_dexterity_pay_in_updata.setEnabled(true);
//                    intent.putExtra("amount", addAndSubView.getNum() + "");
                        intent.putExtra("amount", edit_zhitoumoney.getText().toString());

                        intent.putExtra("productId", productId);
                        LogUtils.e("智投宝id", productId);
                        startActivity(intent);
                        FingerprintUtil.cancel();
                        builder.create().dismiss();
                        popWindow.dismiss();
                        popWindow = null;
//                    popWindow.dismiss();
//                    popWindow = null;
                        V6NewZhiTouDexterityPayInActivity.count = 0;
                        overridePendingTransition(R.anim.right_in,
                                R.anim.right_in);
                    } else if ((V6NewZhiTouDexterityPayInActivity.count + V6iNewInvestCoupActivity.count) >= 5) {
                        Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                PayDexterityActivity.class);
                        intent.putExtra("type", "IN");
//                    CURRENT_DEPOSIT
                        tv_v6_dexterity_pay_in_updata
                                .setBackgroundResource(R.drawable.btn_unclick);
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata
                                .setBackgroundResource(v6button);
                        tv_v6_dexterity_pay_in_updata.setEnabled(true);
//                    intent.putExtra("amount", addAndSubView.getNum() + "");
                        intent.putExtra("amount", edit_zhitoumoney.getText().toString());

                        intent.putExtra("productId", productId);
                        LogUtils.e("智投宝id", productId);
                        startActivity(intent);
//                    popWindow.dismiss();
//                    popWindow = null;
                        V6NewZhiTouDexterityPayInActivity.count = 0;
                        FingerprintUtil.cancel();
                        builder.create().dismiss();
                        popWindow.dismiss();
                        popWindow = null;
                        overridePendingTransition(R.anim.right_in,
                                R.anim.right_in);
                    }


                }

                @Override
                public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
                    showToast(helpString.toString());
                }

                @Override
                public void onAuthenticationSucceeded(FingerprintManagerCompat.AuthenticationResult result) {
//                showToast("解锁成功");
                    if (builder.create() != null) {
                        builder.create().dismiss();
                        if (type == 1) {

                            invest();

                        }
                    } else {

                    }
                }


            });
        }

        public static int count = 0;
        public static int count_julu = 0;

        public void method () {

            count++;
            count_julu++;
        }

        @Override
        protected void onDestroy () {
            super.onDestroy();
            unregisterReceiver(mBroadcastReceiver);
        }

        @Override
        public void onClick (View v){
            switch (v.getId()) {
                case R.id.tv_v6_dexterity_pay_in_updata:
                    if (check.isChecked() == false) {
                        ToastUtil.showCenterToast(V6NewZhiTouDexterityPayInActivity.this,
                                "请阅读并同意智投宝授权委托书");
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    }
                    if (TextUtils.isEmpty(edit_zhitoumoney.getText().toString())) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额不能为空");
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));

                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > maxAmount.intValue()) {
                        int a = maxAmount.intValue() / 10000;

                        tv_v6_dexterity_pay_in_daotime.setText("持有金额上限为" + a + "万元");
//                    tv_v6_dexterity_pay_in_daotime.setText("持有金额已超上限50万元");
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou <= 0 && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() > maxAmount.intValue()) {
//                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");


                        int a = singleTransfer / 10000;
//                       tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限50万元");
                        Double b = Math.floor(a);
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + Regular.getDecimalFormatZero(maxAmount / 10000) + "万元");
//                    tv_v6_dexterity_pay_in_daotime.setText("转入金额已超上限" + b.intValue() + "万元");
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (chiyou + Double.valueOf(edit_zhitoumoney.getText().toString()).intValue()) > max_hold) {
//                    tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为50万元");
                        int a = max_hold / 10000;

                        tv_v6_dexterity_pay_in_daotime.setText("最高持有金额上限为" + a + "万元");

                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && edit_zhitoumoney.getText().toString().equals("0")) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton2);
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if ((Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - minAmount)
                            % increaseNum != 0) {
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额的增量须为" + increaseNum + "的倍数");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
//                                    tv_v6_dexterity_pay_in_daotime.setTextColor(getResources().getColor(R.color.bbt_v4_uplan_fragment_progress_ditou_quan));
                    } else if (getInvestNum() == 0 && MySharePreferenceUtil.get(V6NewZhiTouDexterityPayInActivity.this, "zhiwen", "").equals("1")) {
                        showDialog();
                    } else {
                        AjaxParams params = new AjaxParams();
                        params.put("productId", "");
                        //金额传实际支付的

                        params.put("amount", edit_zhitoumoney.getText().toString());
//
                        VolleryUtil volleryUtil = new VolleryUtil() {
                            @Override
                            public void onUpDate(JSONObject jsonObject) {
                                // TODO Auto-generated method stub
                                LogUtils.e("加息券校验", jsonObject.toString());
                                if (jsonObject.optInt("success") == 1) {
                                    LogUtils.e("加息券校验", jsonObject.toString());
                                    Log.d(jsonObject.toString(), "444444444444");
                                    showPopupWindow(tv_v6_dexterity_pay_in_updata);

                                } else if (jsonObject.optInt("success") == 0 && jsonObject.optString("comment").equals("please login")) {
                                    startActivity(new Intent(V6NewZhiTouDexterityPayInActivity.this, V6LoginActivity.class));
                                } else {
                                    JiaoYanFailBean jiaoYanFailBean = new JiaoYanFailBean();
                                    Gson gson = new Gson();
                                    try {
                                        jiaoYanFailBean = gson.fromJson(jsonObject.toString(), JiaoYanFailBean.class);
                                /*    ToastUtil.showCenterToast(V6NewZhiTouDexterityPayInActivity.this,
                                            jsonObject.optString("comment") + "!");*/
                                        path = jiaoYanFailBean.getData().getPath();
                                        myamount = jiaoYanFailBean.getData().getAmount();
                                        bank_name = jiaoYanFailBean.getData().getBankName();
                                        card_no = jiaoYanFailBean.getData().getCard_no();
                                        type2 = jiaoYanFailBean.getData().getType();
                                        loan_id = jiaoYanFailBean.getData().getLoan_id();
                                        productId = jiaoYanFailBean.getData().getProductId();
                                        getBank_name = jiaoYanFailBean.getData().getBank_name();

                                        showPopupWindow(tv_v6_dexterity_pay_in_updata);
                                        AjaxParams params = new AjaxParams();
                                        params.put("bankName", bank_name + "");//1

                                        VolleryUtil3 volleryUtil = new VolleryUtil3() {
                                            @RequiresApi(api = VERSION_CODES.JELLY_BEAN)
                                            @Override
                                            public void onUpDate(JSONObject jsonObject) {
                                                Log.d(jsonObject.toString(), "333333333333333");
                                                if (jsonObject.optInt("success") == 1) {

                                                    Gson gson1 = new Gson();
                                                    LimitBean limitBean = new LimitBean();
                                                    limitBean = gson1.fromJson(jsonObject.toString(), LimitBean.class);
                                                    LimitBean.DataBean dataBeanList = limitBean.getData();
                                                    limitByOnce = limitBean.getData().getLimitByOnce();
                                                    limitByDay = limitBean.getData().getLimitByDay();
                                                    limitByMonth = limitBean.getData().getLimitByMonth();
                                                    if (TextUtils.isEmpty(limitByOnce)) {
                                                        text_xiane.setTextColor(Color.parseColor("#f21200"));
                                                        text_xiane.setText("银行系统维护中,暂停提供支付功能");
                                                        btn_dexterity_invest.setEnabled(false);
                                                        btn_dexterity_invest.setBackground(getResources().getDrawable(R.color.gray));
                                                    } else {
                                                        int once = Double.valueOf(limitByOnce).intValue() / 10000;
                                                        int day = Double.valueOf(limitByDay).intValue() / 10000;
                                                        int monty = Double.valueOf(limitByMonth).intValue() / 10000;
                                                        text_xiane.setTextColor(Color.parseColor("#9e9e9e"));
                                                        btn_dexterity_invest.setBackground(getResources().getDrawable(R.color.v6_ud_de_tab));
                                                        btn_dexterity_invest.setEnabled(true);

                                                        text_xiane.setText(limitBean.getData().getTips());
                                           /*    int m = Integer.valueOf(limitByOnce);


                                                    int m1 = Integer.valueOf(limitByDay);
                                                    int m2 = Integer.valueOf(limitByMonth);
                                                    String result = "";

                                                    String result1 = "";
                                                    String result2 = "";
                                                    if (m < 10000) {
                                                        int a = Integer.valueOf(m);
                                                        float num = (float) a / 10000;

                                                        DecimalFormat df = new DecimalFormat("0.0");

                                                        result = df.format(num);
                                                    }
                                                    if (m1 < 10000) {
                                                        int a = Integer.valueOf(m1);
                                                        float num = (float) a / 10000;
                                                        DecimalFormat df = new DecimalFormat("0.0");
                                                        result1 = df.format(num);
                                                    }
                                                    if (m2 < 10000) {
                                                        int a = Integer.valueOf(m2);
                                                        float num = (float) a / 10000;
                                                        DecimalFormat df = new DecimalFormat("0.0");
                                                        result2 = df.format(num);
                                                    }
                                                    if (m >= 10000) {
                                                        double n = (double) m / 10000;
                                                        result = n + "";
                                                        result = removeLast0(result);
                                                    }
                                                    if (m1 >= 10000) {
                                                        double n = (double) m1 / 10000;

                                                        result1 = n + "";

                                                        result1 = removeLast0(result1);
                                                    }
                                                    if (m2 >= 10000) {
                                                        double n = (double) m2 / 10000;
                                                        result2 = n + "";
                                                        result2 = removeLast0(result2);
                                                    }
                                                    text_xiane.setText("单笔限额" + result + "万元/" + "单日限额" + result1 + "万元/" + "单月限额" + result2 + "万元");
 */

                                                    }


                                                } else if (jsonObject.optString("comment").equals(
                                                        "please login")) {
                                                    Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                                            LoginActivity.class);
                                                    intent.putExtra("close", 1);
                                                    startActivity(intent);
                                                } else if (jsonObject.optInt("success") == 0) {
                                                    btn_dexterity_invest.setText("充值并投资");
                                                    text_xiane.setTextColor(Color.parseColor("#f21200"));
                                                    text_xiane.setText(jsonObject.optString("comment"));
                                                    btn_dexterity_invest.setEnabled(false);
                                                    btn_dexterity_invest.setBackground(getResources().getDrawable(R.color.gray));

                                                } else


                                                {
                                                }


                                            }


                                            @Override
                                            public void onError() {

                                            }


                                        };

                                        volleryUtil.setShow(true);
                                        volleryUtil.setRequestMethod(0);

                                        volleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this,
                                                Constant.URL + "api/v2/getLLSupportBankLimit?",
                                                params.toString());


                                    } catch (Exception e) {
                                    }


                                }
                            }

                            @Override
                            public void onError() {
                                // TODO Auto-generated method stub

                            }
                        };
                        volleryUtil.setHeaders("token", getToken());
                        volleryUtil.setHeaders("deviceId", getdeviceId());
                        volleryUtil.setRequestMethod(1);
                        volleryUtil.setShow(true);
//                    volleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this, Constant.URL + "/api/v6/invest/invests/valid?", params.toString());
                        volleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this, Constant.URL + "/api/v3/claim/fund/invests/valid?", params.toString());
//                    http://test1.udrmb.com/api/v3/claim/fund/invests/valid


                    }


                    break;
                case R.id.layout_investall:
                case R.id.text_yue:

                case R.id.text_quantou:
                    Log.d(minAmount + "", "111111111111111111");
                    Log.d(increaseNum + "", "111111111111111111");
//起投金额 minamount
                    //投资增量 increasenum
                    //remainAmount 剩余可投金额
//账户可用余额zhangu_keyong
                    if (availableAmount2 <= 0) {
                        if (!check.isChecked()){
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton);
                        }

                    } else if (TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > 500000) {

                /*    edit_zhitoumoney.setText(inAmount + "");
                    edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    tv_v6_dexterity_pay_in_updata.setEnabled(true);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button);*/

                        int a = Double.valueOf(inAmount).intValue() - minAmount;
                        double b = (double) a / increaseNum;
                        Double f = Math.floor(b);
                        int c = f.intValue();

                        int d = c * increaseNum + minAmount;
                        edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                        edit_zhitoumoney.setText(d + "");
                        edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou > 500000) {

//                    edit_zhitoumoney.setText(inAmount + "");
//                    edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
//                    tv_v6_dexterity_pay_in_updata.setEnabled(true);
//                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button);

                        int a = Double.valueOf(inAmount).intValue() - minAmount;
                        double b = (double) a / increaseNum;
                        Double f = Math.floor(b);
                        int c = f.intValue();

                        int d = c * increaseNum + minAmount;
                        edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                        edit_zhitoumoney.setText(d + "");
                        edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (chiyou + Double.valueOf(edit_zhitoumoney.getText().toString()).intValue()) > 500000) {

               /*     edit_zhitoumoney.setText(inAmount + "");
                    edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    tv_v6_dexterity_pay_in_updata.setEnabled(true);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button);*/

                        int a = Double.valueOf(inAmount).intValue() - minAmount;
                        double b = (double) a / increaseNum;
                        Double f = Math.floor(b);
                        int c = f.intValue();

                        int d = c * increaseNum + minAmount;
                        edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                        edit_zhitoumoney.setText(d + "");
                        edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && chiyou <= 0 && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() > 500000) {

        /*            edit_zhitoumoney.setText(inAmount + "");
                    edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    tv_v6_dexterity_pay_in_updata.setEnabled(true);
                    tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6button);*/

                        int a = Double.valueOf(inAmount).intValue() - minAmount;
                        double b = (double) a / increaseNum;
                        Double f = Math.floor(b);
                        int c = f.intValue();

                        int d = c * increaseNum + minAmount;
                        edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                        edit_zhitoumoney.setText(d + "");
                        edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && edit_zhitoumoney.getText().toString().equals("0")) {
                        tv_v6_dexterity_pay_in_updata.setEnabled(false);
                        tv_v6_dexterity_pay_in_updata.setBackgroundResource(R.drawable.v6greybutton);
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() < minAmount) {
                        tv_v6_dexterity_pay_in_daotime.setText(minAmount + "元起投");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                    } else if (!TextUtils.isEmpty(edit_zhitoumoney.getText().toString()) && (Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - minAmount)
                            % increaseNum != 0) {
                        tv_v6_dexterity_pay_in_daotime.setText("转入金额的增量须为" + increaseNum + "的倍数");
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
                        tv_v6_dexterity_pay_in_daotime.setVisibility(View.VISIBLE);
                        tv_v6_dexterity_pay_in_daotime.setTextColor(Color.parseColor("#ff0000"));
//                                    tv_v6_dexterity_pay_in_daotime.setTextColor(getResources().getColor(R.color.bbt_v4_uplan_fragment_progress_ditou_quan));
                    } else {
                        if (zhangu_keyong < 100) {

                            edit_zhitoumoney.setText(100 + "");
                            edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                        } else if (zhangu_keyong >= 100 && zhangu_keyong >= Double.valueOf(inAmount).intValue()) {

                            int a = Double.valueOf(inAmount).intValue() - minAmount;
                            double b = (double) a / increaseNum;
                            Double f = Math.floor(b);
                            int c = f.intValue();

                            int d = c * increaseNum + minAmount;
                            edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                            edit_zhitoumoney.setText(d + "");
                            edit_zhitoumoney.setSelection(edit_zhitoumoney.length());

                        } else {
                            int a = Double.valueOf(zhanghu_keyong).intValue() - minAmount;

                            double b = (double) a / increaseNum;
                            Double f = Math.floor(b);
                            int c = f.intValue();

                            int d = c * increaseNum + minAmount;
                            edit_zhitoumoney.setText(String.valueOf(d));
//                    Toast.makeText(V6NewZhiTouDexterityPayInActivity.this, d + "", Toast.LENGTH_SHORT).show();
                            edit_zhitoumoney.setText(d + "");
                            edit_zhitoumoney.setSelection(edit_zhitoumoney.length());
                        }
                    }


                    break;

                case R.id.rl_back:
                case R.id.img_back:
                    finish();
                    break;
                case R.id.tv_guize:


                    VolleryUtil volleryUtil = new VolleryUtil() {

                        @Override
                        public void onUpDate(JSONObject jsonObject) {
                            Log.d(jsonObject.toString(), "3333333333333333");

                            // TODO Auto-generated method stub
                            if (jsonObject.optInt("success") == 1) {
                                String newtoken = getToken();
                                try {
                                    newtoken = URLEncoder.encode(newtoken, "UTF-8");
//                        myurl1= URLEncoder.encode(myurl1, "UTF-8");
                                } catch (UnsupportedEncodingException e) {
                                }

                                Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this, RuleWebActivity.class);

                                String token = (String) MySharePreferenceUtil.get(V6NewZhiTouDexterityPayInActivity.this, "mytoken", "");


                                try {
                                    token = URLEncoder.encode(token, "UTF-8");

                                } catch (UnsupportedEncodingException e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }
                                intent.putExtra("url", Constant.URL + "api/v6/invest/ztbRules?" + "&app=true&banner=true&appversion=true&token=" + token);
//                            intent.putExtra("url", Constant.URL + "api/v6/invest/ztbRules?"+"banner=true&app=true&appversion=true&token="+(String) MySharePreferenceUtil.get(V6NewZhiTouDexterityPayInActivity.this, "mytoken", ""));
//                            http://test1.udrmb.com/api/v6/invest/ztbRules?app=true&token=FhwMqLikXGoNvir5fiMoHKqlsztDe4cJsjoJbQ1asVHGdBJrQNjzoOxBZ2cGpu%2Bzxzh7qqmZm%2B0%3D
//                            http://test1.udrmb.com/api/v6/invest/ztbRules?app=true&token=FhwMqLikXGoNvir5fiMoHKqlsztDe4cJsjoJbQ1asVHGdBJrQNjzoOxBZ2cGpu%2Bzxzh7qqmZm%2B0%3D
                                intent.putExtra("content", s);
                                intent.putExtra("title", "规则说明");
//                intent.putExtra("content", s);
                                startActivity(intent);
                            } else {
                                if (jsonObject.optString("comment").equals("please login")) {
//						Editor ed=sha.edit();
//						ed.putInt("islogin", 0);
//						ed.commit();
                                    Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                            V6LoginActivity.class);
                                    intent.putExtra("close", 1);
                                    startActivity(intent);
                                } else {
//                        Toast.makeText(V6ZhitouIndexActivity.this, jsonObject.optString("comment"), 2000).show();
                                }
                            }

                        }

                        @Override
                        public void onError() {
                            // TODO Auto-generated method stub

                        }
                    };


                    volleryUtil.setHeaders("token", getToken());
                    volleryUtil.setRequestMethod(0);
                    volleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this, Constant.URL + "/api/v5/user/accountCenter", "");
                    break;


            }


        }


        private void UmengDate () {
            try {
                ApplicationInfo appInfo = this.getPackageManager()
                        .getApplicationInfo(getPackageName(),
                                PackageManager.GET_META_DATA);
                String msg = appInfo.metaData.getString("UMENG_CHANNEL");
                Map<String, String> m = new HashMap<String, String>();
                m.put(msg, msg);
                MobclickAgent.onEventValue(this, "ling_in", m,
                        Integer.valueOf(amount));
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            }
        }

        /**
         * 转入转出
         */
        private void invest () {


            AjaxParams params = new AjaxParams();
            params.put("amount", edit_zhitoumoney.getText().toString() + "");

            params.put("productType", "CURRENT_DEPOSIT");
            params.put("payPass", "");
            params.put("productId", productId);
            params.put("payType", "FINGERPRINT");
            VolleryUtil vollery = new VolleryUtil() {

                @Override
                public void onUpDate(final JSONObject jsonObject) {
                    // TODO Auto-generated method stub
                    Log.e("转出", jsonObject.toString());

                    if (jsonObject.optInt("success") == 1) {

                        final JSONObject json1 = jsonObject.optJSONObject("data");

                        YuePaySuccess yuePaySuccess = new YuePaySuccess();
                        Gson gson = new Gson();
                        yuePaySuccess = gson.fromJson(jsonObject.toString(), YuePaySuccess.class);

                        Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this, SuccessZhiTouYueActivity.class);

                        intent.putExtra("active_url", yuePaySuccess.getData().getExpUrl());

                        intent.putExtra("title", "智投宝");

                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//收益到账
                        Long time = new Long(yuePaySuccess.getData().getExpectDueDate());
                        //起息日期
                        Long time2 = new Long(yuePaySuccess.getData().getCount_rate_date());
                        String d = format.format(time);
                        String e = format.format(time2);
                        intent.putExtra("qixi", e);

                        intent.putExtra("jieshu", d);
                        intent.putExtra("investmoney", yuePaySuccess.getData().getAmount());

                        startActivity(intent);
                        Intent mIntent = new Intent(ACTION_NAME);
                        mIntent.putExtra("yaner", "发送广播，相当于在这里传送数据");
                        //发送广播
                        sendBroadcast(mIntent);

                        finish();

                        UmengDate();


                    } else {
                        Toast.makeText(V6NewZhiTouDexterityPayInActivity.this,
                                jsonObject.optString("comment"), 0).show();
                    }
                }

                @Override
                public void onError() {
                    // TODO Auto-generated method stub
                    Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this, V6ResultFinsh.class);
                    intent.putExtra("title", "转入结果");
                    intent.putExtra("description2", "确认转入结果！若转入失败请重新操作");
                    intent.putExtra("description1", "您好，系统正在处理中，\n请3~5分钟之后前往 “我的账户-智投宝”");
                    intent.putExtra("button", "我的智投宝");
                    startActivity(intent);
                    finish();
                }
            };

            vollery.setShow(true);
            vollery.setHeaders("token", getToken());
            vollery.setHeaders("client", "android");
            vollery.setHeaders("deviceId", getdeviceId());
            vollery.setRequestMethod(1);
            vollery.execute(this, Constant.URL
                    + "api/v2/claim/fund/invest?", params.toString());

        }


        private PopupWindow popWindow;

        private void showPopupWindow (View parent){
            if (popWindow == null) {
                View view = LayoutInflater.from(this)
                        .inflate(R.layout.pop_select_photo2, null);
                //LayoutParams相当于一个Layout的信息包，它封装了Layout的位置、高、宽等信息。
                popWindow = new PopupWindow(view, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, true);
                initPop(view);
            }
            //设置动画效果
            popWindow.setAnimationStyle(android.R.style.Animation_InputMethod);
            //获取popwindow焦点
            popWindow.setFocusable(true);
            //设置popwindow如果点击外面区域，便关闭。
            popWindow.setOutsideTouchable(true);
            popWindow.setBackgroundDrawable(new BitmapDrawable());
            //实现软键盘不自动弹出,ADJUST_RESIZE属性表示Activity的主窗口总是会被调整大小，从而保证软键盘显示空间。
            popWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
            //设置popwindow显示位置
            popWindow.showAtLocation(parent, Gravity.CENTER, 0, 0);
        }

        String getBank_name;
        Double string;

        String limitByOnce;
        String limitByDay;
        String limitByMonth;
        Button btn_dexterity_invest;
        TextView text_xiane;

        public void initPop (View view){
            //头部
            View pop_top = view.
                    findViewById(R.id.pop_top);
            pop_top.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow.dismiss();
                    popWindow = null;
                }
            });
//箭头
            ImageView iv_v4_pay_finish = (ImageView) view.findViewById(R.id.iv_v4_pay_finish);
            iv_v4_pay_finish.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow.dismiss();
                    popWindow = null;
                }
            });


            //投资金额
            text_xiane = (TextView) view.findViewById(R.id.text_xiane);
            TextView text_investmoney = (TextView) view.findViewById(R.id.text_investmoney);

            String resule = edit_zhitoumoney.getText().toString();
            DecimalFormat df = new DecimalFormat("#,###");
            String m = df.format(Double.valueOf(resule).intValue());

            text_investmoney.setText(m + ".00");


            //带银行卡的
            LinearLayout layout_yinhangpay = (LinearLayout) view.findViewById(R.id.layout_yinhangpay);

            TextView text_yinhang = (TextView) view.findViewById(R.id.text_yinhang);

            //充值投资的按钮
            TextView text_bangname = (TextView) view.findViewById(R.id.text_bangname);

            //银行布局

            LinearLayout layout_yinhang = (LinearLayout) view.findViewById(R.id.layout_yinhang);

            btn_dexterity_invest = (Button) view.findViewById(R.id.btn_dexterity_invest);
            text_bangname.setText(getBank_name);
            View view_lines = view.findViewById(R.id.view_lines);
            iv_v4_pay_finish.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    popWindow.dismiss();
                    popWindow = null;
                }
            });
            //余额
            TextView text_useyue = (TextView) view.findViewById(R.id.text_useyue);
            TextView bank_wei = (TextView) view.findViewById(R.id.bank_wei);

            TextView text_yinhang_name = (TextView) view.findViewById(R.id.text_yinhang_name);
            View lines_yinhang = view.findViewById(R.id.lines_yinhang);
            //输入的投资
            final BigDecimal b1 = new BigDecimal(edit_zhitoumoney.getText().toString());
            //可用
            final BigDecimal b2 = new BigDecimal(zhanghu_keyong);
            View layout_kongbai = view.findViewById(R.id.layout_kongbai);
            //带银行卡的
            View view_yinhang = view.findViewById(R.id.view_yinhang);
            //余额小于投资金额
            if (b1.compareTo(b2) > 0) {
                int a = Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - Double.valueOf(zhanghu_keyong).intValue() % 100;
                int n = 4;
                bank_wei.setText("(尾号:" + card_no.substring(card_no.length() - 4, card_no.length()) + ")");
                view_yinhang.setVisibility(View.GONE);
//            text_useyue.setText(Regular.getDecimalFormatTwo(Double.valueOf(String.valueOf(a))) + "元");
                text_useyue.setText(Regular.getDecimalFormatTwo(Double.valueOf(zhanghu_keyong)) + "元");
                //余额小于于投资金额
//            int c = Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - Double.valueOf(tv_availableAmount.getText().toString()).intValue();
//            myamout = Double.valueOf(edit_zhitoumoney.getText().toString()).intValue() - a;
                BigDecimal b3 = new BigDecimal(edit_zhitoumoney.getText().toString());
                BigDecimal b4 = new BigDecimal(zhanghu_keyong);
                string = b3.subtract(b4).doubleValue();
                string = b3.subtract(b4).doubleValue();

                DecimalFormat df2 = new DecimalFormat("#,###");
                String m1 = df2.format(Double.valueOf(string).intValue());

//            text_yinhang.setText(m1 + ".00" + "元");


                text_yinhang.setText(Regular.getDecimalFormatTwo(Double.valueOf(string)) + "元");

                layout_yinhangpay.setVisibility(View.VISIBLE);
                layout_kongbai.setVisibility(View.GONE);
                layout_yinhang.setVisibility(View.VISIBLE);


                btn_dexterity_invest.setText("充值并投资");
                view_lines.setVisibility(View.GONE);

            } else {
         /*   text_useyue.setText(edit_zhitoumoney.getText().toString() + "元");
            //余额大于投资金额
            text_useyue.setText(Regular.getDecimalFormatTwo(Double.valueOf(edit_zhitoumoney.getText().toString())) + "元");*/


                DecimalFormat df2 = new DecimalFormat("#,###");
                String m1 = df2.format(Double.valueOf(Double.valueOf(edit_zhitoumoney.getText().toString())).intValue());

                text_useyue.setText(m1 + ".00" + "元");


//            btn_dexterity_invest.setText("余额支付");

                btn_dexterity_invest.setText("立即支付");
                view_lines.setVisibility(View.VISIBLE);
//            layout_yinhang.setVisibility(View.GONE);
                layout_kongbai.setVisibility(View.VISIBLE);
//            layout_yinhangpay.setVisibility(View.INVISIBLE);
                text_yinhang_name.setText("");
                text_yinhang.setText("");
                lines_yinhang.setVisibility(View.VISIBLE);
//            layout_yinhangpay.setBackgroundColor(getResources().getColor(R.color.white));
                layout_yinhang.setVisibility(View.GONE);
                layout_yinhangpay.setVisibility(View.GONE);
                view_yinhang.setVisibility(View.VISIBLE);

                view_lines.setVisibility(View.GONE);
                lines_yinhang.setVisibility(View.GONE);
                layout_yinhangpay.setVisibility(View.GONE);
                lines_yinhang.setVisibility(View.VISIBLE);
                layout_kongbai.setVisibility(View.VISIBLE);
                view_yinhang.setVisibility(View.VISIBLE);

            }

            btn_dexterity_invest.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
//                verityUser();
                    Intent intent;
                    String newtoken = getToken();
                    try {
                        newtoken = URLEncoder.encode(newtoken, "UTF-8");
//                        myurl1= URLEncoder.encode(myurl1, "UTF-8");
                    } catch (UnsupportedEncodingException e) {
                    }
                    if (b1.compareTo(b2) > 0) {
                        AjaxParams params = new AjaxParams();
                        params.put("amount", string + "");//1
                        params.put("path", path);//1
//                    params.put("card_no", card_no);//1
                        params.put("cardNo", card_no);//1
//                    params.put("investment_Amount", investment_Amount);//1
                        params.put("investment_Amount", edit_zhitoumoney.getText().toString());//1
                        params.put("loan_id", loan_id);//1
                        params.put("client", "android");
                        params.put("token", newtoken);//1
//                    params.put("type", type2);
                        params.put("type", "CURRENT_DEPOSIT");
//                    params.put("bank_name", bank_name);//1
                        NewVolleryUtil newVolleryUtil = new NewVolleryUtil() {
                            @Override
                            public void onError() {

                            }

                            @Override
                            public void onUpDate(String jsonObject) {
                                Log.d(jsonObject.toString(), "3333333333333333");
                                Log.d(jsonObject.toString(), "3333333333333333");

                                Intent intent = new Intent(V6NewZhiTouDexterityPayInActivity.this, NewV6WebviewChild2.class);
                                intent.putExtra("url", jsonObject.toString());
                                Log.d("url", jsonObject.toString());
                                intent.putExtra("amount", string);
                                intent.putExtra("path", path);
                                intent.putExtra("cardNo", card_no);

                                intent.putExtra("investment_Amount", edit_zhitoumoney.getText().toString());

                                intent.putExtra("loan_id", loan_id);


                                intent.putExtra("loan_id", loan_id);


                                intent.putExtra("client", "android");
                                intent.putExtra("token", "");
                                startActivity(intent);
                                popWindow.dismiss();
                                popWindow = null;

                            }

                        };
//                    vollery.OnButtonListener(V6iNewInvestCoupActivity.this);
                        newVolleryUtil.setShow(true);
                        newVolleryUtil.setRequestMethod(1);
                        newVolleryUtil.setHeaders("token", getToken());
                        newVolleryUtil.setHeaders("deviceId", getdeviceId());
                        newVolleryUtil.setHeaders("client", "android");
                        newVolleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this,
                                Constant.URL + "hpay/v3/h5recharge?",
                                params.toString());
/*

                    AjaxParams params = new AjaxParams();
                    params.put("amount", string + "");//1
                    params.put("path", path);//1
//                    params.put("card_no", card_no);//1
                    params.put("cardNo", card_no);//1
//                    params.put("investment_Amount", investment_Amount);//1
                    params.put("token", newtoken);//1

                    params.put("loan_id", loan_id);//1
                    params.put("investment_Amount", edit_zhitoumoney.getText().toString());//1
                    params.put("client", "android");

//                    params.put("type", type2);
                    params.put("type", "CURRENT_DEPOSIT");
                    params.put("coupon_id", "");

                    NewVolleryUtil newVolleryUtil = new NewVolleryUtil() {
                        @Override
                        public void onError() {

                        }

                        @Override
                        public void onUpDate(String jsonObject) {
                            Log.d(jsonObject.toString(), "333333333333");
                            Gson gson = new Gson();
                            YanZhengModel yanZhengModel = new YanZhengModel();
                            yanZhengModel = gson.fromJson(jsonObject.toString(), YanZhengModel.class);
                            Intent intent1 = new Intent(V6NewZhiTouDexterityPayInActivity.this, PayXianFentActivity.class);
                            intent1.putExtra("code", yanZhengModel.getData().getCode());
                            intent1.putExtra("order_id", yanZhengModel.getData().getOrder_id());
                            intent1.putExtra("amount", edit_zhitoumoney.getText().toString());
                            startActivity(intent1);

                            popWindow.dismiss();
                            popWindow = null;

                        }

                    };
                    newVolleryUtil.setShow(true);
                    newVolleryUtil.setRequestMethod(1);
                    newVolleryUtil.setHeaders("token", getToken());
                    newVolleryUtil.setHeaders("deviceId", getdeviceId());
                    newVolleryUtil.setHeaders("client", "android");
                    newVolleryUtil.execute(V6NewZhiTouDexterityPayInActivity.this,
                            Constant.URL + "hpay/v3/h5xfRecharge?",
                            params.toString());

*/

                    } else {

//                    if (getisFingerPay() == 1 && V6NewZhiTouDexterityPayInActivity.count_julu < 5) {
                        int c = V6NewZhiTouDexterityPayInActivity.count_julu;

                        int d = V6iNewInvestCoupActivity.count_julu;
                        int m = c + d;
                        if (getisFingerPay() == 1 && m < 5) {
                            onFingerprintClick(1);
                        } else {

                            intent = new Intent(V6NewZhiTouDexterityPayInActivity.this,
                                    PayDexterityActivity.class);
                            intent.putExtra("type", "IN");

//                    CURRENT_DEPOSIT
                            tv_v6_dexterity_pay_in_updata
                                    .setBackgroundResource(R.drawable.btn_unclick);
                            tv_v6_dexterity_pay_in_updata.setEnabled(false);
                            tv_v6_dexterity_pay_in_updata
                                    .setBackgroundResource(v6button);
                            tv_v6_dexterity_pay_in_updata.setEnabled(true);
//                    intent.putExtra("amount", addAndSubView.getNum() + "");
                            intent.putExtra("amount", edit_zhitoumoney.getText().toString());

                            intent.putExtra("productId", productId);
                            LogUtils.e("智投宝id", productId);
                            startActivity(intent);
                            try {
                                builder.create().dismiss();
                            } catch (Exception e) {

                            }
                            popWindow.dismiss();
                            popWindow = null;
                            overridePendingTransition(R.anim.right_in,
                                    R.anim.right_in);
                        }


                    }


                }
            });

        }

        private CustomDialog2.Builder mDialog;
        KeyguardManager keyguardManager = (KeyguardManager) BbtApplication.getContext().getSystemService(BbtApplication.getContext().KEYGUARD_SERVICE);

        private void showDialog () {
            mDialog = new CustomDialog2.Builder(V6NewZhiTouDexterityPayInActivity.this);

//        mDialog.setMessage("优点智投上线指纹支付功能，是否开启使用？");
            mDialog.setMessage("是否开启指纹支付功能?");
            mDialog.create().setCancelable(false);
            mDialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub

                    mDialog.create().dismiss();
                    SharedPreferences.Editor editor2 = getShare().edit();
                    editor2.putInt("invest_num", getInvestNum() + 1);
                    editor2.commit();
                }
            });
            mDialog.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // TODO Auto-generated method stub
                    if (!keyguardManager.isKeyguardSecure()) {
                        mDialog.create().dismiss();
                        FingerSetting.openFingerPrintSettingPage(V6NewZhiTouDexterityPayInActivity.this);

                        return;
                    }
                    mStartActivity(V6NewZhiTouDexterityPayInActivity.this, V6FingerPayPwdConfirmActivity.class);
                    mDialog.create().dismiss();

                }
            });
            mDialog.create().show();
        }

        @Override
        public void onConfirm () {

        }

        @Override
        public void onCancle () {

        }

        private String removeLast0 (String string){
            if (string == null || string.length() == 0) {
                return "0";
            }
            try {
                while (string.charAt(string.length() - 1) == '0') {
                    string = string.substring(0, string.length() - 1);
                }
                if (string.charAt(string.length() - 1) == '.') {
                    string = string.substring(0, string.length() - 1);
                }
            } catch (Exception e) {
                return "";
            }
            return string;

        }
    }
